package org.flowcircuit.model.component

import board.Socket
import coordinates.PosDir
import utils.ParameterChecker._

/**
 * 
 * 
 * @author Hans Haggstrom
 */
case class Pin( posDir : PosDir ) {

  private var _socket : Socket = null

  def socket = _socket

  def disconnect() {
    if (_socket != null) {
      _socket.pins.remove(this)
    }
  }

  def connect( socket : Socket ) {
    requireNotNull( socket, 'socket )

    disconnect()
    _socket = socket
    _socket.pins.add(this)
  }

}